home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / WINDOWS / CP_72A.ARJ / CMDPOST.CP$ < prev    next >
Text File  |  1992-02-20  |  47KB  |  1,304 lines

  1. ; Define addon menu   USER menus should go into CMDUSER.CPM...by convention...
  2. #NextFile CMDUSER.CPM
  3.  
  4.  
  5. ; CmdPost menu    initialization code
  6.  
  7.         ; Initialize a few variables here. 
  8.         Sounds(0)  ;Turn sounds off awhile
  9.         a=Version()
  10.         CP="CmdPost"
  11.         CPDIR=DirHome()
  12.         cr=strcat(num2char(13),num2char(10))
  13.         crlf=cr
  14.         cpini="WWW-PROD.INI"
  15.         tab=num2char(9)
  16.         Editor=inireadpvt(CP,"Editor","Notepad.exe",cpini)
  17.         CopyMoveDefault=""
  18.         if (NetGetCaps(2)==0) then MenuChange("FileNetwork",@DISABLE)
  19.  
  20.  
  21. ; Setting up the View menu item here.
  22.         a=inireadpvt(CP,"ViewSetup","NO",cpini)
  23.         if a=="NO" then goto DEFSETUP
  24.  
  25.         ViewShortLong=inireadpvt(CP,"ViewShortLong","SHORT",cpini)
  26.  
  27.         if ViewShortLong=="SHORT" then MenuChange("ViewShort",@CHECK)
  28.         if ViewShortLong=="LONG" then MenuChange("ViewLong",@CHECK)
  29.         
  30.         ViewBy=inireadpvt(CP,"ViewBy","NAME",cpini)
  31.         if ViewBy=="NAME" then MenuChange("ViewByName",@CHECK)
  32.         if ViewBy=="DATE" then MenuChange("ViewByDate",@CHECK)
  33.         if ViewBy=="SIZE" then MenuChange("ViewBySize",@CHECK)
  34.         if ViewBy=="KIND" then MenuChange("ViewByKind",@CHECK)
  35.         if ViewBy=="UNSORTED" then MenuChange("ViewUnsorted",@CHECK)
  36.  
  37.         ViewWhat=inireadpvt(CP,"ViewWhat","ALL",cpini)
  38.         if ViewWhat=="ALL" then MenuChange("ViewAll",@CHECK)
  39.         if ViewWhat=="PARTIAL" then MenuChange("ViewPartial",@CHECK)
  40.         if ViewWhat=="PROGRAMS" then MenuChange("ViewPrograms",@CHECK)
  41.  
  42.         SD3="*.*"
  43.         if ViewWhat=="PROGRAMS" then SD3="*.EXE *.COM *.BAT *.PIF"
  44.         if ViewWhat=="PARTIAL" then SD3=inireadpvt(CP,"Partial","*.*",cpini)
  45.         SetDisplay(ViewShortLong,ViewBy,SD3)
  46.         drop(ViewShortLong,ViewBy,ViewWhat,SD3)
  47.         goto PRINTSETUP
  48.  
  49.         :DEFSETUP
  50.         SetDisplay("SHORT","NAME","*.*")
  51.         MenuChange("ViewAll",@CHECK)
  52.         MenuChange("ViewByName",@CHECK)
  53.         MenuChange("ViewShort",@CHECK)
  54.  
  55. ; Setup Print menu item...Kill it if no text printer
  56.         :PRINTSETUP
  57.         MenuChange("FilePrint", (inireadpvt(CP,"TextPrinter","",cpini)=="NONE") *@DISABLE)
  58.         
  59.         if IsRunning() then goto goombye
  60.         a=inireadpvt(CP,"AutoStart","NO",cpini)
  61.         if a!="YES" then goto goombye
  62.  
  63.         ;if Display(3,"Auto Startup","Hit any key to bypass WIN.INI%CR%Run= and Load= processing") then goto goombye
  64.         
  65.         a=iniread("windows","load","")
  66.         b=ItemCount(a," ")
  67.         d=0
  68.         :woop1
  69.         if d==b then goto dorun
  70.         d=d+1
  71.         c=ItemExtract(d,a," ")
  72.         Runicon(c,"")
  73.         goto woop1
  74.         
  75.         :dorun
  76.         a=iniread("windows","run","")
  77.         b=ItemCount(a," ")
  78.         d=0
  79.         :woop2
  80.         if d==b then goto goombye
  81.         d=d+1
  82.         c=ItemExtract(d,a," ")
  83.         Run(c,"")
  84.         goto woop2
  85.  
  86.         :goombye
  87.         Sounds(1) ;Sounds on
  88.         drop(a,b,c,d)
  89.  
  90. ; And the main menu starts.  
  91. &File
  92.  &Run...
  93.         r=CurrentFile()
  94.         if !IsKeyDown(@SHIFT) then r=askline("RUN","Enter file to run",r)
  95.         r=strcat(strtrim(r)," ")
  96.         i=strindex(r," ",0,@FWDSCAN)
  97.         a=strsub(r,1,i-1)
  98.         b=strtrim(strsub(r,i,strlen(r)-i+1))
  99.         run("%a%","%b%")
  100.         drop(a,b,r,i)        
  101.  &Load...
  102.         r=CurrentFile()
  103.         if !IsKeyDown(@SHIFT) then l=askline("LOAD","Enter file to load",CurrentFile())
  104.         l=strcat(strtrim(l)," ")
  105.         i=strindex(l," ",0,@FWDSCAN)
  106.         a=strsub(r,1,i-1)
  107.         b=strtrim(strsub(r,i,strlen(r)-i+1))
  108.         runicon("%a%","%b%")
  109.         drop(a,b,i,l)
  110.  Bro&wse...   \ {F3}
  111.         l=CurrentFile()
  112.         ;if !IsKeyDown(@SHIFT) then l=strtrim(askline("Browse","Enter file to browse",l))
  113.         run("%CPDIR%browser.exe",l)
  114.         drop(a,l)
  115.  &Edit...    \ {F4}
  116.         l=CurrentFile()
  117.         ;if !IsKeyDown(@SHIFT) then l=askline("Edit","Enter file to edit",l)
  118.         if l=="" || l==" " then goto NULL
  119.         a=strscan(l,".\",0,@BACKSCAN)
  120.         if a==0 then l=strcat(l,".")
  121.         if a==0 then goto NULL
  122.         if strsub(l,a,1)!="." then l=strcat(l,".")
  123.      :NULL
  124.         run(Editor,strtrim(l))
  125.         drop(a,b,l)
  126.  &Copy... \ {F8} 
  127.         r=OtherDir()
  128.         if r!=DirGet() then goto NEXT
  129.         if CopyMoveDefault!="" then r=CopyMoveDefault
  130.         :NEXT
  131.         s=strcat(DirItemize("")," ",FileItemize(""))
  132.         terminate(strlen(s)==1,"Copy Error","No files selected")
  133.         if !IsKeyDown(@SHIFT) then r=strtrim(askline("Copy",StrCat(s,CR,CR,"to"),r))
  134.         terminate(r=="","Copy Error","Cannot copy to null file name")        
  135.         q=strindex(r,"\",0,@FWDSCAN) ; Directory Name in there??
  136.         CopyMoveDefault=r
  137.         if q==0 then SetDisplay("","","") ;Nope. Set flag to update directory
  138.         FileCopy(s,r,@TRUE)
  139.         OtherUpdate()
  140.         drop(r,s,q)
  141.  &Move/Rename...  \  {F7}
  142.         r=OtherDir()
  143.         if r!=DirGet() then goto NEXT
  144.         if CopyMoveDefault!="" then r=CopyMoveDefault
  145.         :NEXT
  146.         s=strcat(DirItemize("")," ",FileItemize(""))
  147.         terminate(strlen(s)==1,"Move Error","No files selected")
  148.         if !IsKeyDown(@SHIFT) then r=strtrim(askline("Move",StrCat(s,CR,CR,"to"),r))
  149.         terminate(r=="","Move Error","Cannot move to null file name")
  150.         SetDisplay("","","") ;Set flag to update directory
  151.         CopyMoveDefault=r
  152.         FileMove(s,r,@TRUE)
  153.         OtherUpdate()
  154.         drop(r,s)
  155.  &Delete File... \ {DEL}
  156.         f=FileItemize("")
  157.         if IsKeyDown(@SHIFT) then goto doit
  158.         g=FileSize(f)
  159.         i=ItemCount(f," ")
  160.         terminate(strlen(f)==0,"delete","No files specified")
  161.         if askyesno("Delete %i% files:  %g% bytes ",f)==@NO then exit
  162.         :doit
  163.         SetDisplay("","","") ;Set flag to update directory
  164.         FileDelete(f)
  165.         OtherUpdate()  ; Well if the "other" CmdPost Window points to the
  166.                     ; same directory, it *IS* nice...
  167.         drop(f,g,b)
  168.  
  169.  &Print...
  170.         s=FileItemize("")
  171.         terminate(strlen(s)==0,"Print Error","No files selected")
  172.         TextPrinter=inireadpvt(CP,"TextPrinter","ASK",cpini)
  173.         if TextPrinter!="ASK" then goto NOASK1
  174.         r=AskYesNo("Attention",strcat("This print routine only works with standard printers.",CR,"Do you have a standard (NON-Postscript) printer?"))
  175.         if r==@YES then goto ASK1
  176.         iniwritepvt(CP,"TextPrinter","NONE",cpini)
  177.         MenuChange("FilePrint",@DISABLE)
  178.         Exit
  179.         :ASK1
  180.         TextPrinter="NONE|LPT1|LPT2|LPT3"
  181.         TextPrinter=ItemSelect("Choose the STD text printer",TextPrinter,"|")
  182.         terminate(strlen(TextPrinter)==0,"Error","Nothing chosen")
  183.         iniwritepvt(CP,"TextPrinter",TextPrinter,cpini)
  184.         :NOASK1
  185.         Terminate(TextPrinter=="NONE","ERROR","No Text Printers on system")
  186.         a=AskLine("Print",strcat(s,CR,CR,"to"),TextPrinter)
  187.         FileCopy(s,a,@FALSE)
  188.         
  189.  _File &Info
  190.         a=FileItemize("")
  191.         if a=="" then a=FileItemize("*.*")
  192.         tot=FileSize(a)
  193.         c=ItemCount(a," ") 
  194.         n=0
  195.         b=""
  196.         :loop
  197.         if n==c then goto show
  198.         n=n+1
  199.         a1=StrFix(ItemExtract(n,a," ")," ",14)
  200.         a2=FileSize(a1)
  201.         a3=FileTimeGet(a1)
  202.         a4=FileAttrGet(a1)
  203.         b=strcat(b,a1,tab,a2,tab,a3,tab,a4,"|")
  204.         goto loop
  205.         :show
  206.         ItemSelect("Total Size=%tot%",b,"|")
  207.         :cancel
  208.         drop(a,tot,c,n,a1,a2,a3,a4,b)
  209.         
  210.  &Freespace on Local Drives   
  211.  
  212.         Drive=DiskScan(2)     ; 2 is the code for local hard drives
  213.         Dmax=strlen(Drive)
  214.         DIndex=1
  215.         TotalSize=0
  216.         DriveReport=""
  217.  
  218.         :COUNTSPACE
  219.         NextDrive=StrSub(Drive,Dindex,1)
  220.         a=DiskFree(NextDrive)/1024
  221.         TotalSize=a+TotalSize
  222.         DriveReport=strcat(DriveReport,NextDrive," = ",a,"K","@")
  223.         DIndex=Dindex+3  ;each entry is 3 bytes long
  224.         if DIndex<=Dmax then goto COUNTSPACE
  225.         ItemSelect("Total Space Available = %TotalSize%K",DriveReport,"@")
  226.         Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive)
  227.                    
  228.  _E&xit Windows \ ^X
  229.         EndSession()
  230.         
  231.  |Find file
  232.   On DOS Path
  233.          a=AskLine("Locate file in path","Enter file name to locate",CurrentFile())
  234.          b=FileLocate(a)
  235.          terminate(b=="",a,"File Not Located")
  236.          if AskYesNo(b,"File Located.%CR%Change to that directory?")==@NO then exit
  237.          DirChange(FilePath(b))
  238.          SetDisplay("","","")
  239.   On Current Drive
  240.         Mask=Askline("Find File on drive","Enter file name to locate","*.bak")
  241.         FileList=""
  242.         tot=0
  243.         totdir=0
  244.         DirChange("\")
  245.         LocalList=FileItemize(Mask)
  246.         if LocalList=="" then goto skip11
  247.         tot = FileSize(LocalList)
  248.         totdir=1
  249.         LocalList=strcat(" ",strsub(LocalList,1,strlen(LocalList)-1))
  250.         locdir=DirGet()
  251.         LocalList=strreplace(LocalList," "," %locdir%")
  252.         FileList=LocalList
  253.         Drop(LocalList)
  254.         :Skip11
  255.         level=1
  256.         dir1=DirGet()
  257.         sub1 = DirItemize("*.*")
  258.         numdir1 = ItemCount(sub1, " ")
  259.         index1 = 0
  260.   
  261.         :loop
  262.         If index%level% == numdir%level% Then Goto upalevel
  263.         index%level% = index%level% + 1
  264.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  265.         LocDir = DirGet()
  266.         LocalList=FileItemize(Mask)
  267.         if LocalList=="" then goto skip22
  268.         totdir=totdir+1
  269.         tot = tot + FileSize(LocalList)
  270.         LocalList=strcat(" ",strsub(LocalList,1,strlen(LocalList)-1))
  271.         LocalList=strreplace(LocalList," "," %locdir%")
  272.         FileList=Strcat(FileList,LocalList)
  273.         drop(LocalList)
  274.         :skip22
  275.         level = level + 1
  276.         dir%level%=LocDir
  277.         sub%level% = DirItemize("*.*")
  278.         numdir%level% = ItemCount(sub%level%, " ")
  279.         index%level% = 0
  280.         goto loop
  281.   
  282.         :upalevel
  283.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  284.         level=level-1
  285.         if level!=0 then goto loop
  286.  
  287.         :done
  288.         ; -----------
  289.         ; Termination
  290.         ; -----------
  291.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  292.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  293.         tot = StrTrim(tot)
  294.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  295.         tot = StrTrim(tot)
  296.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  297.         tot = StrTrim(tot)
  298.         if FileList!="" then FileList=Strsub(FileList,2,strlen(FileList)-1)
  299.         level=ItemCount(FileList," ")
  300.         SelectedFile=ItemSelect("%totdir% SubDirs.  %level% Files. %tot% bytes.",FileList," ")
  301.         if SelectedFile=="" then goto GOOMBYE
  302.         DirChange(FilePath(SelectedFile))
  303.         SetDisplay("","","")
  304.         :GOOMBYE
  305.         drop(tot,level,totdir,FileList,SelectedFile)
  306.         
  307.  _&Hilite Files
  308.   By Names
  309.         a=AskLine("Hilite Files","Enter types of files to hilite",strcat("*.",FileExtension(CurrentFile())))
  310.         FileHilite(a,@TRUE)
  311.   By Attribute
  312.         :askagain
  313.         a="Enter an attribute to hilite. R A S  or H"
  314.         b="Use CAPS to hilite if attribute is set,"
  315.         c="Use lowercase to hilite if not set."
  316.         a=strcat(a,CR,b,CR,c,CR,"Enter only one character. R A S or H")
  317.         drop(b,c)
  318.         a=AskLine("Hilite by Attribute",a,"A")
  319.         if strlen(a)!=1 then goto askagain
  320.         case=2
  321.         if (a=='R' || a=='A' || a=='S' || a=='H') then case=1
  322.         if (a=='r' || a=='a' || a=='s' || a=='h') then case=0
  323.         a=strupper(a)
  324.         if case==2 then goto askagain
  325.         d=FileItemize("*.*")
  326.         e=ItemCount(d," ")
  327.         f=0
  328.         :loop
  329.         f=f+1
  330.         if f>e then exit
  331.         q=ItemExtract(f,d," ")
  332.         g=FileAttrGet(q)
  333.         h=strscan(g,a,1,@FWDSCAN)
  334.         if h>0 then h=1
  335.         ;display(3,"%a% %h%","%q% %g%:
  336.         if case==h then filehilite(q,@TRUE)
  337.         ;beep 
  338.         goto loop
  339.  &Unhilite Files
  340.   By Name
  341.         a=AskLine("Unhilite Files","Enter types of files to unhilite",strcat("*.",FileExtension(CurrentFile())))
  342.         FileHilite(a,@FALSE)
  343.   By Attribute
  344.         :askagain
  345.         a="Enter an attribute to hilite. R A S  or H"
  346.         b="Use CAPS to hilite if attribute is set,"
  347.         c="Use lowercase to hilite if not set."
  348.         a=strcat(a,CR,b,CR,c,CR,"Enter only one character. R A S or H")
  349.         drop(b,c)
  350.         a=AskLine("Hilite by Attribute",a,"A")
  351.         if strlen(a)!=1 then goto askagain
  352.         case=2
  353.         if (a=='R' || a=='A' || a=='S' || a=='H') then case=1
  354.         if (a=='r' || a=='a' || a=='s' || a=='h') then case=0
  355.         a=strupper(a)
  356.         if case==2 then goto askagain
  357.         d=FileItemize("*.*")
  358.         e=ItemCount(d," ")
  359.         f=0
  360.         :loop
  361.         f=f+1
  362.         if f>e then exit
  363.         q=ItemExtract(f,d," ")
  364.         g=FileAttrGet(q)
  365.         h=strscan(g,a,1,@FWDSCAN)
  366.         if h>0 then h=1
  367.         ;display(3,"%a% %h%","%q% %g%:
  368.         if case==h then filehilite(q,@FALSE)
  369.         ;beep 
  370.         goto loop
  371.  
  372.  _File Attributes
  373.   View/Modify current file
  374.         DaFile=CurrentFile()
  375.         :REDO
  376.         attr=FileAttrGet(DaFile)
  377.         RD=2
  378.         AR=2
  379.         SY=2
  380.         HD=2
  381.         if strsub(attr,1,1)=="R" then  RD=1
  382.         if strsub(attr,2,1)=="A" then  AR=1
  383.         if strsub(attr,3,1)=="S" then  SY=1
  384.         if strsub(attr,4,1)=="H" then  HD=1
  385.         OldHD=HD
  386.         OldSY=SY
  387.         b=@YES
  388.         DialogBox("View/Modify Attributes","cp_attr2.dlg")
  389.         If OldHD!=HD then b=AskYesNo("Attribute Changer","Note: Changing Hidden attribute is unusual%CR%Continue?")
  390.         if b==@NO then goto REDO
  391.         If OldSy!=SY then b=AskYesNo("Attribute Changer","Note: Changing System attribute is unusual%CR%Continue?")
  392.         if b==@NO then goto REDO
  393.         attr=""
  394.         if RD==1 then attr="R"
  395.         if RD==2 then attr='r'
  396.         if AR==1 then attr=strcat(attr,"A")
  397.         if AR==2 then attr=strcat(attr,"a")
  398.         if HD==1 then attr=strcat(attr,"H")
  399.         if HD==2 then attr=strcat(attr,"h")
  400.         if SY==1 then attr=strcat(attr,"S")
  401.         if SY==2 then attr=strcat(attr,"s")
  402.         FileAttrSet(DaFile,attr)
  403.         SetDisplay("","","")
  404.         
  405.  
  406.   Change hilited files
  407.         a=FileItemize("")
  408.         terminate(a=="","Attribute Changer","No files Hilited")
  409.         string=a
  410.         if strlen(string)<35 then goto REDO
  411.         string=strcat(strfix(string," ",35)," ...")
  412.         :REDO
  413.         RD=3
  414.         AR=3
  415.         SY=3
  416.         HD=3
  417.         b=@YES
  418.         DialogBox("Attribute Changer","cp_attr1.dlg")        
  419.         If HD!=3 then b=AskYesNo("Attribute Changer","Note: Changing Hidden attribute is unusual%CR%Continue?")
  420.         if b==@NO then goto REDO
  421.         If SY!=3 then b=AskYesNo("Attribute Changer","Note: Changing System attribute is unusual%CR%Continue?")
  422.         if b==@NO then goto REDO
  423.         attr=""
  424.         if RD==1 then attr="R"
  425.         if RD==2 then attr='r'
  426.         if AR==1 then attr=strcat(attr,"A")
  427.         if AR==2 then attr=strcat(attr,"a")
  428.         if HD==1 then attr=strcat(attr,"H")
  429.         if HD==2 then attr=strcat(attr,"h")
  430.         if SY==1 then attr=strcat(attr,"S")
  431.         if SY==2 then attr=strcat(attr,"s")
  432.         FileAttrSet(a,attr)
  433.         SetDisplay("","","")
  434.  
  435.  
  436.         
  437.  _Floppy Space
  438.   A:
  439.         message(strcat("Drive A ",DiskFree("A")),strcat("Selected Files ",FileSize(FileItemize(""))))
  440.   B:
  441.         message(strcat("Drive B ",DiskFree("B")),strcat("Selected Files ",FileSize(FileItemize(""))))
  442.  
  443.  _&Network
  444.   Connect Drive to Net
  445.          AvailDrive=DiskScan(0)
  446.          DrvLen=strlen(AvailDrive)
  447.          if DrvLen==0 then goto NOMORE
  448.          AvailDrive=Strsub(AvailDrive,DrvLen-2,2)
  449.          NetPath=NetBrowse(0)
  450.          pswd=AskPassword("Enter password for",NetPath)
  451.          NetAddCon(NetPath,pswd,AvailDrive)
  452.          exit
  453.          :NOMORE
  454.          Message("Connect Drive to Net","No drives avail for assignment")
  455.          
  456.          
  457.   Disconnect
  458.          AvailDrive=DiskScan(4)
  459.          a=Itemcount(AvailDrive," ")
  460.          if a==0 then exit
  461.          i=1
  462.          DisList=""
  463.          :loop
  464.          b=ItemExtract(i,AvailDrive," ")
  465.          DisList=strcat(b,num2char(9),NetGetCon(b),"|")
  466.          i=i+1
  467.          if i<a then goto loop
  468.          AvailDrive=ItemSelect("Disconnect",DisList,"|")
  469.          NetCancelCon(AvailDrive,0)
  470.   Net Dialog
  471.          NetDialog()         
  472.          
  473.          
  474.  _&Extensions...
  475.         a=strtrim(CurrentFile())
  476.         i=strindex(a,".",0,@FWDSCAN)
  477.         terminate(i==0,"Association Error","Associated files must have an extension")
  478.         b=FileExtension(a)
  479.         c=iniread("extensions",b,"???.EXE ^.%b%")
  480.         d=askline("Associate","%b% files are associated with",c)
  481.         terminate(c==d,"","")
  482.         iniwrite("extensions",b,d)
  483.         
  484. &Dir
  485.  Create Director&y...
  486.         a=askline("Create Directory","Enter directory to create",DirGet())
  487.         terminate(a=="","Create Error","Cannot create directory with null name")
  488.         DirMake(strtrim(a))
  489.         SetDisplay("","","")
  490.         drop(a)
  491.  
  492.  &Rename Directory...
  493.         a=DirItemize("")
  494.         terminate(ItemCount(a," ")!=1,"Rename Error","Zero or more than one dir specified")
  495.         b=strtrim(AskLine("Rename Directory","Enter new directory name for %a%",a))
  496.         terminate(a==b || b=="","Rename Error","Illegal name change specified")
  497.         DirRename(strtrim(a),b)
  498.         SetDisplay("","","")
  499.         OtherUpdate()
  500.         drop(a,b)
  501.  
  502.  &Kill Directory...
  503.         f=DirItemize("")
  504.         terminate(strlen(f)==0,"Delete Directory","No directory specified")
  505.         ;terminate(@no==askyesno("Delete Directory",f),"Delete Directory","Directory not deleted")
  506.         DirRemove(strtrim(f))
  507.         SetDisplay("","","")
  508.         OtherUpdate()   ; Well if the "other" CmdPost Window points to the
  509.                       ; same directory, it *is* nice
  510.         drop(f)
  511.  
  512.  &Change Directory...
  513.         a=DirGet()
  514.         b=strindex(a,':',1,@fwdscan)
  515.         c=strtrim(askline("Change Directory","Enter directory name",strsub(a,b+1,strlen(a)-b-1)))
  516.         terminate(c=="","Directory Error","Directory with null name does not exist")
  517.         DirChange(c)
  518.         SetDisplay("","","")
  519.         drop(a,b,c)                       
  520.         
  521.  _&Nuke ENTIRE file/dir structure
  522.         files=FileItemize("")
  523.         numfile=ItemCount(files, " ")
  524.         totdir=0
  525.         dir1=DirGet()
  526.         sub1 = DirItemize("")
  527.         numdir1=Itemcount(sub1, " ")
  528.         if (numfile+numdir1)==0 then goto noselect
  529.         Pause("WARNING: Are you Sure :WARNING", "You are about to delete all kinds of stuff%CR%containing possibly 10 zillion files and subdirs.%CR%Continue?")
  530.         if AskYesNo("WARNING: Are you REALLY Sure :WARNING","Shall we stop now and not delete anything?")==@YES then goto quitnow
  531.         if AskYesNo("WARNING: Are you Sure :WARNING","CONTINUE???!!!??? %CR%Are you sure you can find your backups???")==@NO then goto nobackup
  532.   
  533.         if numfile > 0 then FileDelete(files)   ;Whap top level files...
  534.         If numdir1 == 0 Then Goto didit
  535.         level=1
  536.         index1=0
  537.   
  538.   
  539.         :loop
  540.         If index%level% == numdir%level% Then Goto upalevel
  541.         index%level% = index%level% + 1
  542.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  543.         totdir=totdir+1
  544.         Errormode(@off)
  545.         FileDelete("*.*")
  546.         Errormode(@cancel)
  547.         level = level + 1
  548.         dir%level% = DirGet()
  549.         sub%level% = DirItemize("*.*")
  550.         numdir%level% = ItemCount(sub%level%, " ")
  551.         index%level% = 0
  552.         goto loop
  553.   
  554.         :upalevel
  555.         a=strlen(dir%level%)                                 ;7.0S-- bug workaround
  556.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)      ;ditto
  557.         DirChange(dir%level%)
  558.         DirRemove(sub%level%)
  559.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  560.         level=level-1
  561.         if level!=0 then goto loop
  562.         :didit
  563.         SetDisplay("","","")
  564.         OtherUpdate()
  565.         Display(4,"Operation Complete","Files in %totdir% subdirectories deleted")
  566.         goto done
  567.   
  568.         :noselect
  569.         Message("Sorry", "You must highlight target files/directories first.") 
  570.         goto done
  571.         :nobackup
  572.         Message("Well Then","We better not play around with nuclear devices")
  573.         goto done
  574.         :quitnow
  575.         Message("Good Thinking","A wise move. Nothing deleted")
  576.         :done
  577.         drop(files,numfile,dir1,numdir1,totdir)
  578.  
  579.  &Duplicate ENTIRE file/dir structure
  580.         Other0=OtherDir()
  581.         totdir=0
  582.         files=FileItemize("")
  583.         numfile=ItemCount(files, " ")
  584.         dir1=DirGet()
  585.         OrigDir=strsub(dir1,1,1)            ;7.0s-- bug workaround
  586.         sub1 = DirItemize("")
  587.         numdir1=Itemcount(sub1, " ")
  588.         if (numfile+numdir1)==0 then goto noselect
  589.         Other0=AskLine("Replicate structure",strcat(sub1,' ',files,CR,CR,"to"),Other0)
  590.         terminate(Other0=="" || Other0==" ","Copy Error","Cannot copy to null file name")
  591.         a=strsub(Other0,strlen(Other0),1)
  592.         if (a!=":" && a!="\") then Other0=strcat(Other0,"\")
  593.   
  594.         if numfile > 0 then FileCopy(files,Other0,@FALSE)   ;Copy top level files...
  595.         If numdir1 == 0 Then Goto didit
  596.         level=1
  597.         index1=0
  598.         ; debug(1)
  599.         :loop
  600.         If index%level% == numdir%level% Then Goto upalevel
  601.         index%level% = index%level% + 1
  602.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  603.         totdir=totdir+1
  604.         a=level-1
  605.         Other%level%=StrCat(Other%a%,ItemExtract(index%level%, sub%level%, " "),"\")
  606.         Errormode(@off)
  607.         DirMake(Other%level%)
  608.         LogDisk(Origdir)                       ;7.0s-- bug workaround
  609.         FileCopy("*.*",Other%level%,@FALSE)
  610.         Errormode(@cancel)
  611.         level = level + 1
  612.         dir%level% = DirGet()
  613.         sub%level% = DirItemize("*.*")
  614.         numdir%level% = ItemCount(sub%level%, " ")
  615.         index%level% = 0
  616.         goto loop
  617.   
  618.         :upalevel
  619.         a=strlen(dir%level%)                              ;7.0S-- Workaround
  620.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)   ;7.0S-- Workaround
  621.         DirChange(dir%level%)
  622.        
  623.         drop(dir%level%,sub%level%,index%level%,Other%level%)
  624.         level=level-1
  625.         if level!=0 then goto loop
  626.         :didit
  627.         SetDisplay("","","")
  628.         OtherUpdate()
  629.         Display(4,"Duplicate Structure Complete","%totdir% directories duplicated")
  630.         goto done
  631.   
  632.         :noselect
  633.         Message("Sorry", "You must highlight source files/directories first.")
  634.         :done
  635.         drop(files,numfile,dir1,numdir1,Other0)
  636.         
  637.  &Move ENTIRE file/dir structure
  638.         Other0=OtherDir()
  639.         totdir=0
  640.         files=FileItemize("")
  641.         numfile=ItemCount(files, " ")
  642.         dir1=DirGet()
  643.         OrigDir=strsub(dir1,1,1)            ;7.0s-- bug workaround
  644.         sub1 = DirItemize("")
  645.         numdir1=Itemcount(sub1, " ")
  646.         if (numfile+numdir1)==0 then goto noselect
  647.         Other0=AskLine("Move structure",strcat(sub1,' ',files,CR,CR,"to"),Other0)
  648.         terminate(Other0=="" || Other0==" ","Move Error","Cannot move to null name")
  649.         a=strsub(Other0,strlen(Other0),1)
  650.         if (a!=":" && a!="\") then Other0=strcat(Other0,"\")
  651.   
  652.         if numfile > 0 then FileMove(files,Other0,@FALSE)   ;Copy top level files...
  653.         If numdir1 == 0 Then Goto didit
  654.         level=1
  655.         index1=0
  656.         ; debug(1)
  657.         :loop
  658.         If index%level% == numdir%level% Then Goto upalevel
  659.         index%level% = index%level% + 1
  660.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  661.         totdir=totdir+1
  662.         a=level-1
  663.         Other%level%=StrCat(Other%a%,ItemExtract(index%level%, sub%level%, " "),"\")
  664.         Errormode(@off)
  665.         DirMake(Other%level%)
  666.         LogDisk(Origdir)                       ;7.0s-- bug workaround
  667.         FileMove("*.*",Other%level%,@FALSE)
  668.         Errormode(@cancel)
  669.         level = level + 1
  670.         dir%level% = DirGet()
  671.         sub%level% = DirItemize("*.*")
  672.         numdir%level% = ItemCount(sub%level%, " ")
  673.         index%level% = 0
  674.         goto loop
  675.   
  676.         :upalevel
  677.         a=strlen(dir%level%)                              ;7.0S-- Workaround
  678.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)   ;7.0S-- Workaround
  679.         DirChange(dir%level%)
  680.         DirRemove(sub%level%)
  681.         drop(dir%level%,sub%level%,index%level%,Other%level%)
  682.         level=level-1
  683.         if level!=0 then goto loop
  684.         :didit
  685.         SetDisplay("","","")
  686.         OtherUpdate()
  687.         Display(4,"Move Structure Complete","%totdir% directories moved")
  688.         goto done
  689.   
  690.         :noselect
  691.         Message("Sorry", "You must highlight source files/directories first.")
  692.         :done
  693.         drop(files,numfile,dir1,numdir1,Other0)
  694.         
  695.  &Size of ENTIRE file/dir structure
  696.         tot = FileSize(FileItemize(""))
  697.         totdir=0
  698.         level=1
  699.         dir1=DirGet()
  700.         sub1 = DirItemize("")
  701.         numdir1 = ItemCount(sub1, " ")
  702.         index1 = 0
  703.   
  704.         :loop
  705.         If index%level% == numdir%level% Then Goto upalevel
  706.         index%level% = index%level% + 1
  707.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  708.         totdir=totdir+1
  709.         tot = tot + FileSize(FileItemize("*.*"))
  710.         level = level + 1
  711.         dir%level% = DirGet()
  712.         sub%level% = DirItemize("*.*")
  713.         numdir%level% = ItemCount(sub%level%, " ")
  714.         index%level% = 0
  715.         goto loop
  716.   
  717.         :upalevel
  718.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  719.         level=level-1
  720.         if level!=0 then goto loop
  721.  
  722.         :done
  723.         ; -----------
  724.         ; Termination
  725.         ; -----------
  726.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  727.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  728.         tot = StrTrim(tot)
  729.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  730.         tot = StrTrim(tot)
  731.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  732.         tot = StrTrim(tot)
  733.         Message("%totdir% Subdirecctories included", "Total size %tot% bytes.")
  734.         drop(tot,level,totdir)
  735.  
  736.  
  737.  
  738.  _&Format Diskette...
  739.         ; A wonderful example of variable substitution
  740.         D1="1) 5.25 High Density (1.2M)"
  741.         D2="2) 5.25 Standard (360K)"
  742.         D3="3) 3.5  High Density (1.44M)"
  743.         D4="4) 3.5  Standard (720K)"
  744.         D0="0) None"
  745.         DriveA=inireadpvt(CP,"DriveA","ASK",cpini)
  746.         DriveB=inireadpvt(CP,"DriveB","ASK",cpini)
  747.         if DriveA!="ASK" & DriveB!="ASK" then goto DOFORMAT
  748.  
  749.         DC="%D1%|%D2%|%D3%|%D4%|%D0%"
  750.         Message("Attention","Command Post needs to learn what kind of floppies %CR% the system has.  Please select accordingly.")
  751.         :ASKA
  752.         a=ItemSelect("Select type of Drive A",DC,"|")
  753.         if a!="" then goto OKDRIVEA
  754.         Message("You MUST select an option for A.","Please retry")
  755.         goto ASKA
  756.         :OKDRIVEA
  757.         DriveA=strsub(a,1,1)
  758.         iniwritepvt(CP,"DriveA",DriveA,cpini)
  759.  
  760.         :ASKB
  761.         a=ItemSelect("Select type of Drive B",DC,"|")
  762.         if a!="" then goto OKDRIVEB
  763.         Message("You MUST select an option for B.","Please retry")
  764.         goto ASKB
  765.         :OKDRIVEB
  766.         DriveB=strsub(a,1,1)
  767.         iniwritepvt(CP,"DriveB",DriveB,cpini)
  768.  
  769.         :DOFORMAT
  770.         A0=""
  771.         A1="1)    A:   5.25 HD (1.2M)|2)    A:   5.25 DD (360K)"
  772.         A2="2)    A:   5.25 DD (360K)"
  773.         A3="3)    A:   3.5 HD (1.44M)|4)    A:   3.5 Std (720K)"
  774.         A4="4)    A:   3.5 Standard (720K)"
  775.         B0=""
  776.         B1="5)    B:   5.25 HD (1.2M)|6)    B:   5.25 DD (360K)"
  777.         B2="6)    B:   5.25 Standard (360K)"
  778.         B3="7)    B:   3.5 HD (1.44M)|8)    B:   3.5 DD (720K)"
  779.         B4="8)    B:   3.5 DD (720K)"
  780.         FF=strcat(A%DriveA%,"|",B%DriveB%)
  781.         drop(A0,A1,A2,A3,A4,B0,B1,B2,B3,B4)
  782.  
  783.         FF=ItemSelect("Choose Format Type Desired",FF,"|")
  784.         terminate(FF=="","Format","No parameters selected")
  785.  
  786.         FF=strsub(FF,1,1)   ; FF will be 1 thru 8 (with luck)
  787.         DR=strsub("AB",(FF>4)+1,1)  ; DR is desired drive
  788.         FF=FF-((FF>4)*4)            ; FF is 1 thru 4
  789.         F11=""
  790.         F12="/4"
  791.         F22=""
  792.         F33=""
  793.         F34="/n:9 /t:80"
  794.         F44=""
  795.         DC=Drive%DR%   ; get drive type
  796.         FC=F%DC%%FF%
  797.         FC="%DR%:  %FC%"
  798.         DC=strsub(D%FF%,4,strlen(d%FF%)-3)
  799.         Pause("Attention",strcat("Preparing to format %DC%",CR,"diskette in Drive %DR% with command:",CR,"FORMAT %FC%"))
  800.         comspec=environment("COMSPEC")
  801.         run(comspec,"/c format.com %FC%")
  802.         drop(D0,D1,D2,D3,D4,DC,xxx,DriveA,DriveB)
  803.         drop(FF,DR,F11,F12,F22,F33,F34,F44,DC,FC,comspec)
  804.  
  805.  _Directory &Tree
  806.         run("%CPDIR%cp_tree.exe","")
  807.  
  808.  
  809.  
  810. &View
  811.  &Short
  812.         SetDisplay("SHORT","","")
  813.         MenuChange("ViewShort",@CHECK)
  814.         MenuChange("ViewLong",@UNCHECK)
  815.         iniwritepvt(CP,"ViewShortLong","SHORT",cpini)
  816.  &Long
  817.         SetDisplay("LONG","","")
  818.         MenuChange("ViewShort",@UNCHECK)
  819.         MenuChange("ViewLong",@CHECK)
  820.         iniwritepvt(CP,"ViewShortLong","LONG",cpini)
  821.  _&All
  822.         SetDisplay("","","*.*")
  823.         MenuChange("ViewAll",@CHECK)
  824.         MenuChange("ViewPartial",@UNCHECK)
  825.         MenuChange("ViewPrograms",@UNCHECK)
  826.         iniwritepvt(CP,"ViewWhat","ALL",cpini)
  827.  &Partial...
  828.         a=inireadpvt(CP,"Partial","*.*",cpini)
  829.         a=AskLine("View Partial","Enter types of files desired",a)
  830.         iniwritepvt(CP,"Partial",a,cpini)
  831.         SetDisplay("","",a)
  832.         MenuChange("ViewAll",@UNCHECK)
  833.         MenuChange("ViewPartial",@CHECK)
  834.         MenuChange("ViewPrograms",@UNCHECK)
  835.         iniwritepvt(CP,"ViewWhat","PARTIAL",cpini)
  836.  P&rograms
  837.         SetDisplay("","","*.EXE *.COM *.BAT *.PIF")
  838.         MenuChange("ViewAll",@UNCHECK)
  839.         MenuChange("ViewPartial",@UNCHECK)
  840.         MenuChange("ViewPrograms",@CHECK)
  841.         iniwritepvt(CP,"ViewWhat","PROGRAMS",cpini)
  842.  _By &Name
  843.         SetDisplay("","NAME","")
  844.         MenuChange("ViewByName",@CHECK)
  845.         MenuChange("ViewByDate",@UNCHECK)
  846.         MenuChange("ViewBySize",@UNCHECK)
  847.         MenuChange("ViewByKind",@UNCHECK)
  848.         MenuChange("ViewUnsorted",@UNCHECK)
  849.         iniwritepvt(CP,"ViewBy","NAME",cpini)
  850.  By &Date
  851.         SetDisplay("","DATE","")
  852.         MenuChange("ViewByName",@UNCHECK)
  853.         MenuChange("ViewByDate",@CHECK)
  854.         MenuChange("ViewBySize",@UNCHECK)
  855.         MenuChange("ViewByKind",@UNCHECK)
  856.         MenuChange("ViewUnsorted",@UNCHECK)
  857.         iniwritepvt(CP,"ViewBy","DATE",cpini)
  858.  By Si&ze
  859.         SetDisplay("","SIZE","")
  860.         MenuChange("ViewByName",@UNCHECK)
  861.         MenuChange("ViewByDate",@UNCHECK)
  862.         MenuChange("ViewBySize",@CHECK)
  863.         MenuChange("ViewByKind",@UNCHECK)
  864.         MenuChange("ViewUnsorted",@UNCHECK)
  865.         iniwritepvt(CP,"ViewBy","SIZE",cpini)
  866.  By &Kind       
  867.         SetDisplay("","KIND","")
  868.         MenuChange("ViewByName",@UNCHECK)
  869.         MenuChange("ViewByDate",@UNCHECK)
  870.         MenuChange("ViewBySize",@UNCHECK)
  871.         MenuChange("ViewByKind",@CHECK)
  872.         MenuChange("ViewUnsorted",@UNCHECK)
  873.         iniwritepvt(CP,"ViewBy","KIND",cpini)
  874.  &Unsorted
  875.         SetDisplay("","UNSORTED","")
  876.         MenuChange("ViewByName",@UNCHECK)
  877.         MenuChange("ViewByDate",@UNCHECK)
  878.         MenuChange("ViewBySize",@UNCHECK)
  879.         MenuChange("ViewByKind",@UNCHECK)
  880.         MenuChange("ViewUnsorted",@CHECK)
  881.         iniwritepvt(CP,"ViewBy","UNSORTED",cpini)
  882.  
  883.  |&1 Stack
  884.         winarrange(1)
  885.  &2 Arrange
  886.         winarrange(2)
  887.  &3 Arrange in Rows
  888.         winarrange(3)
  889.  &4 Arrange in Columns
  890.         winarrange(4)
  891.  _&5 (w/o CP) Stack
  892.         winiconize("")
  893.         winarrange(1)
  894.  &6 (w/o CP) Arrange
  895.         winiconize("")
  896.         winarrange(2)
  897.  &7 (w/o CP) Arrange in Rows
  898.         winiconize("")
  899.         winarrange(3)
  900.  &8 (w/o CP) Arrange in Cols
  901.         winiconize("")
  902.         winarrange(4)
  903.         
  904.  _Change &Wallpaper
  905.            DirChange(DirWindows(0))
  906.            a=FileItemize("*.BMP")
  907.            a=strcat("-None- ",a)
  908.            a=ItemSelect("Select New Wallpaper",a," ")
  909.            terminate(a=="","Wallpaper","No wallpaper selected")
  910.            if a=="-None-" then Wallpaper("",0)
  911.            if a=="-None-" then exit
  912.            tile=@FALSE
  913.            if FileSize(a)<40000 then tile=@TRUE  
  914.            ;if bmp size less than 40K, assume tile, else center
  915.            Wallpaper(a,tile)
  916.            drop(a,tile)
  917.  
  918.  
  919. &Main
  920.  &Command Post (More Windows)
  921.        a=IntControl(2,0,0,0,0)      ; retrieves number of open CmdPost Windows
  922.        if a==4 then goto posit
  923.           DirChange(CPDIR)
  924.           run("cmdpost.exe","")
  925.           exit
  926.        :posit
  927.           IntControl(6,0,0,0,0)   ;Repositions all open cp windows
  928.  Command &Post (Show All Windows)
  929.           IntControl(6,0,0,0,0)   ;Repositions all open cp windows
  930.        
  931.  Control &Panel
  932.         errormode(@off)
  933.         terminate(winactivate("Control Panel"),"","")
  934.         errormode(@cancel)
  935.         run("control.exe","")
  936.  
  937.  C&lipboard
  938.         errormode(@off)
  939.         terminate(winactivate("Clipboard"),"","") ;Already Running
  940.         errormode(@cancel)
  941.         run("Clipbrd.exe","")
  942.  
  943.  &DOS Prompt
  944.         run(Environment("COMSPEC"),"")
  945.  
  946.  _Get &Help Cardfile
  947.            run("cardfile.exe","%CPDIR%cp_help.crd")
  948.  Get &Question 'n' Answer Cardfile
  949.            run("cardfile.exe","%CPDIR%cp_quest.crd")
  950.  
  951.  Preferences
  952.   Show System/Hidden Files
  953.         a=strupper(inireadpvt(CP,"SysHide","0",cpini))
  954.         c="YES"
  955.         if a==0 then c="NO"
  956.         b=AskYesNo("System/Hidden Files","Show System and Hidden files?%CR%Current answer=%c%%CR%Enter desired answer")
  957.         if a!=b then iniwritepvt(CP,"SysHide",b,cpini)
  958.         IntControl(5,b,0,0,0)                 ;Controls system/hidden show flag
  959.         SetDisplay("","","")
  960.  
  961.   Save CmdPost Window Positions
  962.         c=IntControl(2,0,0,0,0)     ;This guy returns # of CP Windows open
  963.         b1="Do you wish to save the current CmdPost"
  964.         b2="window positions for future startups?"
  965.         b3="Note: You can save positions of combinations"
  966.         b4="of 1, 2, 3, and 4 window positions."
  967.         b5="Now saving window positions for %c% windows"
  968.         b1=strcat(b1,CR,b2,CR,CR,b3,CR,b4,CR,b5)
  969.         drop(b2,b3,b4,b5)
  970.         a=AskYesNo("CmdPost Window Positions",b1)
  971.         if a==@YES then IntControl(3,0,0,0,0) ;This causes all cp's to write
  972.         exit                                  ;their position information
  973.  
  974.   Printer Options
  975.         iniwritepvt(CP,"TextPrinter","ASK",cpini)
  976.         MenuChange("FilePrint",@ENABLE)
  977.         b1="CmdPost's saved information reset."
  978.         b2="You will be prompted to re-enter the"
  979.         b3="necessary information when it is required."
  980.         b1=strcat(b1,CR,b2,CR,b3)
  981.         Message("Information Reset",b1)
  982.  
  983.   Floppy Options
  984.         iniwritepvt(CP,"DriveA","ASK",cpini)
  985.         iniwritepvt(CP,"DriveB","ASK",cpini)
  986.         b1="CmdPost's saved information reset."
  987.         b2="You will be prompted to re-enter the"
  988.         b3="necessary information when it is required."
  989.         b1=strcat(b1,CR,b2,CR,b3)
  990.         Message("Information Reset",b1)
  991.  
  992.  
  993.   Auto Run= and Load= Options
  994.         a=strupper(inireadpvt(CP,"AutoStart","NO",cpini))
  995.         b=AskYesNo("Auto Startup from WIN.INI","Auto start from WIN.INI RUN= and LOAD= lines?%CR%Current answer=%a%%CR%Enter desired answer")
  996.         if b==@YES then b=AskYesNo("Auto Startup from WIN.INI","Generally this option is set only%CR%when you make CmdPost your shell.%CR%Continue?")
  997.         if b==@NO then b="NO"
  998.         if b==@YES then b="YES"
  999.         if a!=b then iniwritepvt(CP,"AutoStart",b,cpini)
  1000.         
  1001.   CmdPost Window Titles
  1002.    Window 1
  1003.         c=strcat("Command Post ",version()," #")
  1004.         a=1
  1005.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1006.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1007.         iniwritepvt(CP,"Title%a%",b,cpini)
  1008.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1009.    Window 2
  1010.         c=strcat("Command Post ",version()," #")
  1011.         a=2
  1012.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1013.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1014.         iniwritepvt(CP,"Title%a%",b,cpini)
  1015.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1016.    Window 3
  1017.         c=strcat("Command Post ",version()," #")
  1018.         a=3
  1019.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1020.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1021.         iniwritepvt(CP,"Title%a%",b,cpini)
  1022.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1023.    Window 4
  1024.         c=strcat("Command Post ",version()," #")
  1025.         a=4
  1026.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1027.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1028.         iniwritepvt(CP,"Title%a%",b,cpini)
  1029.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1030.  
  1031.   View Startup Options
  1032.         a=strupper(inireadpvt(CP,"ViewSetup","NO",cpini))
  1033.         b=AskYesNo("Remember View options","Should View menu options be remembered?%CR%Current answer=%a%%CR%Enter desired answer")
  1034.         if b==@NO then b="NO"
  1035.         if b==@YES then b="YES"
  1036.         if a!=b then iniwritepvt(CP,"ViewSetup",b,cpini)
  1037.         
  1038.   Editor Options
  1039.         Editor=strtrim(strupper(AskLine("Editor Selection","Enter desired editor",Editor)))
  1040.         iniwritepvt(CP,"Editor",Editor,cpini)
  1041.           
  1042.   File Refresh
  1043.    On
  1044.            IniWritePvt(CP,"AutoUpdate",1,cpini)
  1045.            MenuChange("MainPreferencesFileRefreshOn",@CHECK)
  1046.            MenuChange("MainPreferencesFileRefreshOff",@UNCHECK)
  1047.    Off
  1048.            IniWritePvt(CP,"AutoUpdate",0,cpini)
  1049.            MenuChange("MainPreferencesFileRefreshOn",@UNCHECK)
  1050.            MenuChange("MainPreferencesFileRefreshOff",@CHECK)
  1051.            
  1052.   Default startup program
  1053.            a=IniRead("Extensions","*","Browser.exe")         
  1054.            a=AskLine("Default startup program","Enter program to run for file when%CR%file extension is not defined",a)
  1055.            iniwrite("Extensions","*",a)
  1056.    
  1057.           
  1058.  _Run "Managers"           
  1059.  
  1060.   P&rogram Manager
  1061.         errormode(@off)
  1062.         terminate(winactivate("Program Manager"),"","") ;Already Running
  1063.         errormode(@cancel)
  1064.         run("Progman.exe","")
  1065.  
  1066.   &File Manager
  1067.         errormode(@off)
  1068.         terminate(winactivate("File Manager"),"","") ;Already Running
  1069.         errormode(@cancel)
  1070.         run("winfile.exe","")
  1071.  
  1072.   Print &Manager
  1073.         run("printman.exe","")   ; takes care of itself
  1074.  
  1075.  
  1076.  _Edit Configurations
  1077.   &Edit CmdPost menus
  1078.    CMDPOST.CPM
  1079.            DirChange(FilePath(FileLocate("%CPDIR%CMDPOST.CPM")))
  1080.            a="CMDPOST.CPM"
  1081.  
  1082.            ;it it already running???  Find it...
  1083.            b=WinItemize()
  1084.            bup=StrUpper(b)
  1085.            c=ItemCount(bup,tab)
  1086.            d=0
  1087.            :woop
  1088.            if c==d then goto doit
  1089.            d=d+1
  1090.            e=itemextract(d,bup,tab)
  1091.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1092.            e=itemextract(d,b,tab)
  1093.            WinActivate(e)
  1094.            goto goombye
  1095.            
  1096.            :doit
  1097.            bup=strcat( FileRoot(a),".BAK")
  1098.            FileCopy(a,bup,@FALSE);
  1099.            run(Editor,a)
  1100.            :goombye
  1101.            drop(a,b,c,d,e,bup)
  1102.    CMDUSER.CPM
  1103.            DirChange(FilePath(FileLocate("%CPDIR%CMDPOST.CPM")))
  1104.            a="CMDUSER.CPM"
  1105.  
  1106.            ;it it already running???  Find it...
  1107.            b=WinItemize()
  1108.            bup=StrUpper(b)
  1109.            c=ItemCount(bup,tab)
  1110.            d=0
  1111.            :woop
  1112.            if c==d then goto doit
  1113.            d=d+1
  1114.            e=itemextract(d,bup,tab)
  1115.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1116.            e=itemextract(d,b,tab)
  1117.            WinActivate(e)
  1118.            goto goombye
  1119.            
  1120.            :doit
  1121.            bup=strcat( FileRoot(a),".BAK")
  1122.            FileCopy(a,bup,@FALSE);
  1123.            run(Editor,a)
  1124.            :goombye
  1125.            drop(a,b,c,d,e,bup)
  1126.  
  1127.   Edit &INI files
  1128.         DirChange(DirWindows(0))
  1129.         canned="BYEBYE"
  1130.         IniFiles=""
  1131.  
  1132.         :UP1
  1133.         canned="byebye"
  1134.         If IniFiles!="" then goto inied
  1135.         IniFiles=FileItemize("*.INI")
  1136.         :inied
  1137.         TheFile=ItemSelect("Choose Desired INI file",IniFiles," ")
  1138.         if TheFile=="" then goto newini
  1139.         Sections=""
  1140.  
  1141.         :UP2
  1142.         canned="up1"
  1143.         if Sections!="" then goto sected
  1144.         Sections=IniItemizePvt("",TheFile)
  1145.         :SECTED
  1146.         Section=ItemSelect("%TheFile% - Choose Section",Sections,TAB)
  1147.         if Section=="" then goto AddSect
  1148.         KeyValues=""
  1149.  
  1150.         :UP3
  1151.         canned="up2"
  1152.         if KeyValues!="" then goto looped
  1153.         Keys=IniItemizePvt(Section,TheFile)
  1154.         KeyMax=ItemCount(Keys,TAB)
  1155.         KeyIndex=0
  1156.  
  1157.         :Loop
  1158.         if KeyIndex==KeyMax then goto looped
  1159.         KeyIndex=KeyIndex+1
  1160.         ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  1161.         ThisValue=IniReadPvt(Section,ThisKey,"???",TheFile)
  1162.         KeyValues=strcat(KeyValues,ThisKey,"= ",ThisValue,TAB)
  1163.         goto Loop
  1164.  
  1165.         :looped
  1166.         Key=ItemSelect("%TheFile% [%Section%] - Choose Keyword",KeyValues,TAB)
  1167.         if Key=="" then goto AddKey
  1168.         Key=ItemExtract(1,Key,"=")
  1169.  
  1170.         Value=IniReadPvt(Section,Key,"???",TheFile)
  1171.         goto entkey
  1172.  
  1173.  
  1174.         :newini
  1175.         canned="UP1"
  1176.         TheFile=Askline("Making NEW INI file","Enter new INI file name","*.INI")
  1177.         if (TheFile=="*.INI" || TheFile=="") then goto newini
  1178.         IniFIles=""
  1179.         goto AddSectNewIni
  1180.  
  1181.         :AddSect
  1182.         canned="up2"
  1183.         :AddSectNewIni
  1184.         Section=AskLine("Add New Section to INI File","Enter new section name for%CR%   %TheFile%%CR%      [?????]","")
  1185.         Sections=""
  1186.         goto AddKeyNewSect
  1187.  
  1188.         :AddKey
  1189.         canned="up3"
  1190.         :AddKeyNewSect
  1191.         Key=AskLine("Add New Keyword to INI File","Enter new key name for%CR%   %TheFile%%CR%      [%Section%]","")
  1192.         Value="(Undefined)"
  1193.         KeyValues=""
  1194.         goto EntKeyNewKey
  1195.  
  1196.         :ENTKEY
  1197.         canned="up3"
  1198.         :EntKeyNewkey
  1199.         NewValue=AskLine("Modify INI File Keyword","%TheFile%%CR%   [%Section%]%CR%      %Key% = %Value%",Value)
  1200.         if NewValue!=Value then iniwritepvt(Section,Key,NewValue,TheFile)
  1201.         KeyValues=""
  1202.         goto up3
  1203.  
  1204.         :CANCEL
  1205.         goto %Canned%
  1206.  
  1207.         :BYEBYE
  1208.         exit
  1209.  
  1210.  
  1211.   Run System Confi&guration Editor
  1212.            run("sysedit.exe","")  ;takes care of itself
  1213.   Run Windows Setup
  1214.         DirChange(DirWindows(0))
  1215.         run("setup.exe","")
  1216.         drop(a)
  1217.   Restart Windows
  1218.    NO! Wait
  1219.         Display(4,"OK","I'll wait")
  1220.    Really! Doit!
  1221.         IntControl(66,0,0,0,0)
  1222.         
  1223.            
  1224.  
  1225.   _PIF Edi&t...
  1226.         a=strupper(FileExtension(CurrentFile()))
  1227.         if a!="PIF" then goto PIF2
  1228.         run("pifedit.exe",CurrentFile())
  1229.         exit
  1230.         :PIF2
  1231.         if IsKeyDown(@SHIFT)==@YES then DirChange(FilePath(FileLocate("_default.pif")))
  1232.         a=FileItemize("*.PIF")
  1233.         if a==""  then DirChange(FilePath(FileLocate("_default.pif")))
  1234.         if a=="" then a=FileItemize("*.PIF")
  1235.         a=ItemSelect("Choose a PIF File to edit",a," ")
  1236.         run("pifedit.exe",a)
  1237.         exit
  1238.  
  1239.  _&System Information
  1240.        wintype="retail"
  1241.        if WinMetrics(22) then wintype="debug"
  1242.  
  1243.         wc=WinConfig()
  1244.         if !(wc&1) then mode="Real"
  1245.         if wc&16 then mode="Standard"
  1246.         if wc&32 then mode="Enhanced"
  1247.  
  1248.         if wc&2 then cpu=286
  1249.         if wc&4 then cpu=386
  1250.         if wc&8 then cpu=486
  1251.         if wc&64 then cpu=8086
  1252.         if wc&128 then cpu=80186
  1253.  
  1254.         Sysinfo=strcat(cpu,' ',mode,' ',wintype,' Windows ',WinVersion(1),'.',WinVersion(0),CR)
  1255.  
  1256.         math="No math"
  1257.         if wc&1024 then math="Math"
  1258.         mouse="No Mouse"
  1259.         if WinMetrics(19) then mouse="Mouse"
  1260.  
  1261.         Sysinfo=strcat(sysinfo,math," co-processor.   ",mouse,' available.',CR)
  1262.  
  1263.         sysinfo=strcat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution.  ",WinMetrics(-1),"  colors.",CR)
  1264.  
  1265.         ErrorMode(@OFF)
  1266.         LastError()
  1267.         PlayMedia("Status WaveForm Ready")
  1268.         ErrorMode(@CANCEL)
  1269.         if LastError()!=1193 then sysinfo=strcat(sysinfo,"Windows multimedia extensions present.",CR)
  1270.  
  1271.         bug=NetGetCaps(2)
  1272.         if bug==0 then math="No n"
  1273.         if bug!=0 then math="N"
  1274.         if bug==256 then math="Microsoft n"
  1275.         if bug==512 then math="Lan Manager n"
  1276.         if bug==768 then math="Novell NetWare n"
  1277.         if bug==1024 then math="Banyan Vines n"
  1278.         if bug==1280 then math="10 Net n"
  1279.         sysinfo=strcat(sysinfo,math,"etwork installed.",CR)
  1280.  
  1281.         bug=WinResources(0)/1024   ; Compute memory avail
  1282.         math=strlen(bug)
  1283.         if math>3 then bug=strcat(strsub(bug,1,math-3),',',strsub(bug,math-2,3))
  1284.  
  1285.         sysinfo=strcat(sysinfo,CR,bug," KB Free Memory",CR)
  1286.         sysinfo=strcat(sysinfo,WinResources(2),"%% System Resources Free (",WinResources(3),"%% GDI, ",WinResources(4),"%% User)",CR)
  1287.  
  1288.         sysinfo=strcat(sysinfo,"DOS ",DosVersion(1),'.',DosVersion(0),"  using ",environment("COMSPEC"),CR)
  1289.         disks=DiskScan(1)
  1290.         if disks!="" then sysinfo=strcat(sysinfo,"Floppies ",disks,CR)
  1291.         disks=DiskScan(2)
  1292.         if disks!="" then sysinfo=strcat(sysinfo,"Hard Disks ",disks,CR)
  1293.         disks=DiskScan(4)
  1294.         if disks!="" then sysinfo=strcat(sysinfo,"Network Disks ",disks,CR)
  1295.         sysinfo=strcat(sysinfo,"Windows Directory ",DirWindows(0),CR)
  1296.         sysinfo=strcat(sysinfo,"System  Directory ",DirWindows(1),CR)
  1297.  
  1298.         ver=Version()
  1299.         Message("Command Post %ver% SysInfo",Sysinfo)
  1300.  
  1301.  
  1302.  
  1303.     
  1304.